package com.example.stock.scheduler;

import com.example.stock.service.StockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 股票数据定时更新任务
 *
 * @author zwg
 * @date 2025/8/5 22:13
 */
@Component
@Slf4j
public class StockDataScheduler {
    @Autowired
    private StockService stockService;

    /**
     * 定时更新股票数据
     * 配置在application.properties中
     */
    //@Scheduled(cron = "${stock.schedule.cron}")
    public void scheduledUpdateStockData() {
        log.info("执行定时任务: 更新股票数据");
        stockService.updateStockData();
    }
}
